package com.itheima.dao;

import com.itheima.pojo.Link;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.Mapper;

public interface LinkMapper extends Mapper<Link> {

    @Select("select max(sort) FROM t_link")
    int selectmaxsort();

    @Select("select * FROM t_link where sort=#{sort}")
    Link selectBysort(@Param("sort") int sort);

    @Update("update t_link set sort=#{sort} where uid=#{uid}")
    int sticklink(@Param("uid") String uid,@Param("sort") int sort);

    @Update("update t_link set click_count=click_count+1 where uid=#{uid}")
    int addLinkCount(@Param("uid") String uid);
}
